home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / Dev / Amiga-E / E_v3.2a / Src / Gfx / PPV.e < prev    next >
Text File  |  1992-09-02  |  854b  |  33 lines

  1. /* 256 greyscale preview of POVRAY files
  2.  
  3.    Quickly preview POV-ray's 24-bit output files on a 256 greyscale
  4.    AGA screen. No fancy implementation.
  5.  
  6. */
  7.  
  8. MODULE 'tools/file', 'tools/exceptions'
  9.  
  10. PROC main() HANDLE
  11.   DEF scr=NIL,win=NIL,a,p,name,xs,ys,x,y
  12.   name:=IF arg[] THEN arg ELSE 'data.dis'
  13.   p:=readfile(name)
  14.   xs:=p[0]+(p[1]*256); ys:=p[2]+(p[3]*256); p:=p+4
  15.   WriteF('POV-Ray Quick 256 Greyscale PreView, $#%!\n' +
  16.          'file: "\s", (\dx\d) [mouse to quit]\n',name,xs,ys)
  17.   IF scr:=OpenS(xs,ys,8,$0,'')
  18.     IF win:=OpenW(0,0,xs,ys,$8,0,'',scr,15,0)
  19.       FOR a:=0 TO 255 DO SetColour(scr,a,a,a,a)
  20.       FOR y:=0 TO ys-1
  21.         p:=p+2
  22.         FOR x:=0 TO xs-1 DO Plot(x,y,p[x]+p[x+xs]+p[x+xs+xs]/3)
  23.         p:=xs*3+p
  24.       ENDFOR
  25.       WaitIMessage(win)
  26.     ENDIF
  27.   ENDIF
  28. EXCEPT DO
  29.   CloseW(win)
  30.   CloseS(scr)
  31.   report_exception()
  32. ENDPROC
  33.